package com.zzyl.nursing.controller.member;

import com.zzyl.common.core.controller.BaseController;
import com.zzyl.common.core.domain.R;
import com.zzyl.common.core.page.TableDataInfo;
import com.zzyl.nursing.domain.FamilyMember;
import com.zzyl.nursing.domain.Reservation;
import com.zzyl.nursing.dto.NursingProjectDto;
import com.zzyl.nursing.service.IReservationService;
import com.zzyl.serve.domain.NursingProject;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * @author LENOV
 */
@RestController
@RequestMapping("/member/orders/project")
public class ReservationController extends BaseController {
    @Autowired
    private IReservationService reservationService;
    @GetMapping("/page")
    @ApiOperation("分页查询项目")
    public TableDataInfo<List<NursingProject>> page(NursingProjectDto dto) {
        startPage();
        List<NursingProject> list = reservationService.findByPage(dto);
        return getDataTable(list);
    }
    @GetMapping("/{id}")
    @ApiOperation("通过id查询项目")
    public R<NursingProject> findById(@PathVariable Long id) {
        NursingProject nursingProject = reservationService.findById(id);
        return R.ok(nursingProject);
    }
}
